home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Compilation 1 / Macintosh Compilation CD Number 1 (December 1995).iso / Internet / InterPPP™ 1.2.1 / InterPPP™ Online Docs / InterPPP™ Online Docs.rsrc / TEXT_137.txt < prev    next >
Encoding:
Text File  |  1994-02-14  |  16.2 KB  |  565 lines

  1. Appendix B ‚Ä¢ CCL Scripts
  2.  
  3. Contents of this Appendix
  4.  
  5. ‚Ä¢   B.1 Modifying CCL Scripts
  6.  
  7. ‚Ä¢  B.2 Printing CCL Scripts
  8.  
  9. ‚Ä¢  B.3 Writing CCL Scripts
  10.  
  11. ‚Ä¢  B.4 Using Strings
  12.  
  13. ‚Ä¢  B.5 Using CCL Statements
  14.  
  15. ‚Ä¢   B.6 Using Labels
  16.  
  17. ‚Ä¢  B.7 Using Comments
  18.  
  19. ‚Ä¢  B.8 Using Serial Port Control Commands
  20.  
  21. ‚Ä¢  B.9 Using Scripts Flow Control Commands
  22.  
  23. ‚Ä¢  B.10 Using Iteration Commands
  24.  
  25. ‚Ä¢  B.11 Using User Notification Commands
  26.  
  27. ‚Ä¢  B.12 Using Pattern Matching Commands
  28.  
  29.  
  30. This section provides a quick overview of CCL. For more detailed information, consult the AppleTalk Remote Access Modem Developer‚Äôs Guide.  This can be purchased from the Apple Programmers and Developers Association by calling 1.800.282.2732 or sending AppleLink email to APDA
  31.  
  32. CCL, or Connection Control Language, is the language used to write modem scripts. Each different type of modem requires a modem script to send commands from the Macintosh to the modem. The commands sent to the modem are used to configure and connect the modem to the remote network.
  33.  
  34. The CCL scripts used with InterPPP are simple text files designed to dial and answer particular modems. The documents can be copied from machine to machine and can be printed.
  35.  
  36. The CCL scripts execute in one of three possible modes: originate, answer, or hangup. Each mode has a separate entry point. When a call is initiated, the script is run in originate mode. When call answering is enabled, the script is run in answer mode. When terminating a connection, the script is run in hangup mode.
  37.  
  38. ¬†           Because InterPPP does not answer calls, the answer mode does not 
  39.              apply to the InterPPP application. Information regarding the answer 
  40.              mode, such as @ANSWER, is provided for technical accuracy and 
  41.              compatibility with AppleTalk Remote Access CCL scripts.
  42.  
  43.  
  44.  
  45. B.1 Modifying CCL Scripts
  46.  
  47. InterPPP and your modem manufacturer provide default scripts for generic modems. Usually, there should be no need to edit these scripts. If it is necessary to edit a script, use the following procedures as well as the information in Section B.3, Writing CCL Scripts , and in the AppleTalk Remote Access Modem Developer‚Äôs Guide.
  48.  
  49. To edit an existing CCL script:
  50.  
  51. 1.  Select Open CCL Script‚Ķ from the File menu.
  52.  
  53. ‚àö  Apple‚Äôs standard Open File dialog (Figure B.1) is displayed.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. Figure B.1 Apple‚Äôs Standard Open File Dialog
  67.  
  68.  
  69. 2.  Select a CCL script and click Open. (Or click Cancel to close the dialog 
  70.          without opening a CCL script.)
  71.  
  72. ‚àö  The selected CCL script opens (Figure B.2).
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. Figure B.2 An  Example of an Open CCL Script
  92.  
  93.  
  94. 3.  Edit the text as necessary. Use the Cut, Copy, and Paste commands of 
  95.          the Edit menu if needed.
  96.  
  97.  
  98.  
  99. B.2 Printing CCL Scripts
  100.  
  101. To print a CCL script:
  102.  
  103. 1. Open the CCL script (see Section B.1, Modifying CCL Scripts ,  for 
  104.         information).
  105.  
  106. 2.  Select Print‚Ķ from the File menu.
  107.  
  108. ‚àö  Apple‚Äôs standard Print dialog is displayed.
  109.  
  110. 3.  Select your printing options and click Print. (Or click Cancel to close
  111.          the dialog without printing.)
  112.  
  113. ‚àö  The CCL script is printed.
  114.  
  115.  
  116.  
  117. B.3 Writing CCL Scripts
  118.  
  119. If InterPPP or your modem manufacturer does not provide a CCL script for the modem you are using, you can create a script using the information in the following sections, as well as the information in the AppleTalk Remote Access Modem Developer‚Äôs Guide .
  120.  
  121. To create a CCL script:
  122.  
  123. 1.  Select New CCL‚Ķ from the File menu.
  124.  
  125. ‚àö  A standard text editing window labeled Untitled is displayed.
  126.  
  127. 2.  Use the information in Section B .4- B.12   to enter the text. Use the 
  128.          Cut, Copy, and Paste  commands of the Edit menu as necessary.
  129.  
  130. 3.  Select Save from the File menu to save the CCL script.
  131.  
  132. ‚àö  Apple‚Äôs standard Save dialog is displayed.
  133.  
  134. 4.  Name the CCL script, select the location where it is to be saved, and 
  135.          click Save. (Or click Cancel to close the dialog without saving the 
  136.          script.)
  137.  
  138. ‚àö  The name of the CCL script is displayed at the top of the window.
  139.  
  140. ¬†           To use the script you have created in a connection document, select it 
  141.              from the pop-up menu in the Modem Configuration dialog. See 
  142.              Section 5.1, Modem Configuration ,  for more information.
  143.  
  144.  
  145.  
  146. B.4 Using Strings
  147.  
  148. The strings used in CCL scripts are enclosed in quotes (" "). Defined varStrings are:
  149.  
  150. varString 1        the dial string (the phone number)
  151. varString 2         the modem ‚Äúspeaker on‚Äù flag
  152.  
  153.                ¬†A varString   is a string that contains parameters for modem setup, 
  154.                 such as the phone number the modem is calling and whether the 
  155.                 modem‚Äôs speaker is on or off during dialing.
  156.  
  157.  
  158. The following special characters are allowed within strings:
  159.  
  160. \13         substitutes a carriage return (hex 0D) into the string.
  161. \00         substitutes a null character (hex 00) into the string.
  162. \\             substitutes the \ character (hex 53) into the string.
  163. \^            substitutes the ^ character into the string.
  164. \"             substitutes the " character into the string.
  165. ^1         substitutes the varString into the string.
  166. ^*           substitutes the ASK string into the string.
  167.  
  168. The ^ character is used to reference a varString to substitute into the string. 
  169.  
  170.  
  171. B.5 Using CCL Statements
  172.  
  173. Modem scripts are stored as text files, with one CCL statement per line, either a label, comment, or command.
  174.  
  175. Labels              begin with an at sign (@) and continue until the end of the line. 
  176.                            They denote a point in the script that is the target of a jump
  177.                            from another part of the script. There are two kinds of labels, 
  178.                            symbolic and numeric. Symbolic labels contain the at sign (@)
  179.                            followed by a word. Numeric labels contain the at sign (@) 
  180.                            followed by a number. 
  181.  
  182. Comments      begin with an exclamation mark (!) and continue until the end 
  183.                             of the line. 
  184.  
  185. Commands     start with a word (the command name) and are followed by 
  186.                              arguments on the rest of the line. Blank lines are ignored.
  187.  
  188.  
  189. B.6 Labels
  190.  
  191. @ANSWER    
  192.      marks the point in the script where execution begins in answer mode.
  193. Syntax    
  194.      @ANSWER
  195.  
  196.  
  197. @HANGUP    
  198.      marks the point in the script where execution begins in hangup mode.
  199. Syntax    
  200.      @HANGUP
  201.  
  202.  
  203. @LABEL    
  204.      sets a numeric label in the script. You can then reference this label from
  205.      other script commands like JUMP, JSR, and IFTRIES. A script may have 
  206.      up to 128 labels, numbered 1 through 128.
  207. Syntax    
  208.      @LABEL labelnum
  209. Parameter    
  210.      labelnum         a value from 1-128 that specifies the label number
  211. Example    
  212.      @LABEL 30
  213.  
  214.  
  215. @ORIGINATE    
  216.      marks the point in the script where execution begins in originate mode.
  217. Syntax    
  218.      @ORIGINATE
  219.  
  220.  
  221.  
  222. B.7 Comments
  223.  
  224. !Comment    
  225.      designates a comment line in the script. Comments can begin anywhere 
  226.      in a command line and extend to the end of the line.
  227. Syntax    
  228.      ! comment
  229. Example    
  230.      ! This is a comment line.
  231.  
  232.  
  233.  
  234. B.8 Serial Port Control Commands
  235.  
  236. DTRCLEAR    
  237.      clears the DTR (Data Terminal Ready) signal on the RS-232 interface.
  238. Syntax    
  239.      DTRCLEAR
  240.  
  241.  
  242. DTRSET    
  243.      sets the DTR signal on the RS-232 interface.
  244. Syntax    
  245.      DTRSET
  246.  
  247.  
  248. FLUSH    
  249.      empties all characters from the serial input buffer.
  250. Syntax    
  251.      FLUSH
  252.  
  253.  
  254. HSRESET    
  255.      sets the serial flow control options. 
  256. Syntax    
  257.      HSRESET outputXON/XOFF outputCTS XON XOFF 
  258.      inputXON/XOFF inputDTR
  259.  
  260.            ¬†The PPP protocol ignores XOn/XOff because it is unable to process     
  261.              these characters. They are provided to ensure backward 
  262.              compatibility with AppleTalk Remote Access CCL scripts.
  263.  
  264. Parameters    
  265.      outputXON/XOFF    XOn/XOff      handshaking for output
  266.      outputCTS    CTS                                    hardware handshaking for output
  267.      XON                                                              specifies the XOn character 
  268.      XOFF                                                            specifies the XOff character
  269.      inputXON/XOFF    XOn/XOff         handshaking for input
  270.      inputDTR    DTR                                      hardware handshaking for input
  271. Example    
  272.      HSRESET 0 1 0 0 0 0
  273.  
  274.  
  275. LBREAK     
  276.      generates a long break (3.5 seconds) on the serial output.
  277. Syntax    
  278.      LBREAK
  279.  
  280.  
  281. SBREAK    
  282.      generates a short break (233 milliseconds) on the serial output.
  283. Syntax    
  284.      SBREAK
  285.  
  286.  
  287. SERRESET    
  288.      configures the serial driver, providing values for baud rate, parity, 
  289.      databits, and stop bits. Giving a zero value for any of the parameters 
  290.      causes the default value to be used.
  291. Syntax    
  292.      SERRESET baudRate parity dataBits stopBits
  293. Parameters    
  294.      baudRate         300, 1200, 2400, 4800, 9600 (default), 19200, 38400, or 57600
  295.      parity                 1 for odd parity, 2 for even parity, 3 for no parity (default)
  296.      dataBits            5, 6, 7, or 8 (default)
  297.      stopBits             1 for 1 stop bit (default), 2 for 2 stop bits, 3 for 1.5 stop bits
  298. Example    
  299.      SERRESET 9600, 3, 8, 1
  300.  
  301.          ¬†Proper operation of PPP requires 8 databits, no parity, and 1 stop bit.
  302.  
  303.  
  304.  
  305. SETSPEED    
  306.      sets the asynchronous serial interface speed to the specified speed. Use 
  307.      SETSPEED to set speeds other than those allowed in SERRESET.
  308. Syntax    
  309.      SETSPEED interfacespeed
  310. Parameters    
  311.      interfacespeed         the serial interface speed
  312. Example    
  313.      SETSPEED 14400
  314.  
  315.  
  316. WRITE    
  317.      writes the specified message to the serial driver.
  318. Syntax    
  319.      WRITE message
  320. Parameters    
  321.      message         the message written to the serial driver
  322.  
  323.           ¬†  The following example sends the message variable string 1 and
  324.               carriage return to the serial driver.
  325.  
  326. Example    
  327.      WRITE "ATDT^1\13"
  328.  
  329.  
  330.  
  331. B.9 Script Flow Control Commands 
  332.  
  333. EXIT    
  334.      terminates execution of the script and returns a result. If the script 
  335.      completes successfully, the result returned is zero. If the script fails for 
  336.      any reason, the result returned is a CCL error code.
  337. Syntax    
  338.      EXIT result
  339. Parameters    
  340.      result         a CCL error code
  341.  
  342.           ¬†  The example below shows the script exiting and returning the error 
  343.               result code for a busy signal (-6022).
  344.  
  345. Example    
  346.      EXIT -6022
  347.  
  348.  
  349. JSR    
  350.      causes script execution to jump to the subroutine specified by the label, 
  351.      saving the address of the line following the JSR command. Upon 
  352.      encountering a RETURN command, execution resumes at the line 
  353.      following the JSR command.
  354. Syntax    
  355.      JSR jumpLabel
  356. Parameters    
  357.      jumpLabel         the label to jump to, where execution continues
  358. Example    
  359.      JSR 50
  360.  
  361.  
  362. JUMP    
  363.      causes script execution to continue at the specified label.
  364. Syntax    
  365.      JUMP jumpLabel
  366. Parameters    
  367.      jumpLabel         the label to jump to, where execution continues
  368. Example    
  369.      JUMP 56
  370.  
  371.  
  372. IFANSWER    
  373.      causes execution to continue at the specified label, if the script is running 
  374.      in answer mode.
  375. Syntax    
  376.      IFANSWER jumpLabel
  377. Parameters    
  378.      jumpLabel         the label to jump to, where execution continues
  379. Example    
  380.      IFANSWER 30
  381.  
  382.  
  383. IFORIGINATE    
  384.      causes execution to continue at the specified label, if the script is running
  385.      in originate mode.
  386. Syntax    
  387.      IFORIGINATE jumpLabel
  388. Parameters    
  389.      jumpLabel         the label to jump to, where execution continues
  390. Example    
  391.      IFORIGINATE 30
  392.  
  393.  
  394. IFSTR    
  395.      compares two strings. If the strings are equal, the script continues 
  396.      execution at the specified label.
  397. Syntax    
  398.      IFSTR varStringIndex jumpLabel compareString
  399. Parameters    
  400.      varStringIndex         the index of the varString to compare with
  401.      jumpLabel                    the label to jump to, where execution continues
  402.      compareString          the string that the varStringIndex string is compared
  403.                                             against
  404.  
  405.           ¬†   In the following example, if the ‚Äúmodem speaker on‚Äù flag equals 1, 
  406.               execution jumps to label X. 
  407.  
  408. Example    
  409.      IFSTR 2 X "1"
  410.  
  411.  
  412. PAUSE    
  413.      causes script execution to stop for a specified period of time.
  414. Syntax    
  415.      PAUSE time
  416. Parameters    
  417.      time         the time to pause, in tenths of a second
  418.  
  419.             ¬†The following example causes script execution to pause for 2 
  420.               seconds.
  421.  
  422. Example    
  423.      PAUSE 20
  424.  
  425.  
  426. RETURN    
  427.      terminates a subroutine. Script execution continues with the line 
  428.      following the last JSR command executed.
  429. Syntax    
  430.      RETURN
  431.  
  432.  
  433.  
  434. B.10 Iteration Commands
  435.  
  436. DECTRIES    
  437.      decrements the internal try counter by one.
  438. Syntax    
  439.      DECTRIES
  440.  
  441.  
  442. IFTRIES    
  443.      compares a parameter with the internal try counter. If they are equal, 
  444.      the script continues execution at the specified label. 
  445. Syntax    
  446.      IFTRIES numTries jumpLabel
  447. Parameters    
  448.      numTries           the parameter to compare against the internal try counter
  449.      jumpLabel         the label to jump to, where execution continues
  450.  
  451.           ¬†  The following example checks to see if the internal try counter is 
  452.               equal to 3. If it is, the execution jumps to label 62 and continues.
  453.  
  454. Example    
  455.      IFTRIES 3 62
  456.  
  457.  
  458. INCTRIES    
  459.      increments the internal try counter by one. 
  460. Syntax    
  461.      INCTRIES
  462.  
  463.  
  464. SETTRIES    
  465.      initializes the internal try counter to the specified value.
  466. Syntax    
  467.      SETTRIES tries
  468. Parameters    
  469.      tries         the value to assign to the internal try counter
  470. Example    
  471.      SETTRIES 0
  472.  
  473.  
  474.  
  475. B.11 User Notification Commands
  476.  
  477. ASK    
  478.      displays a dialog to obtain information from the user when the script is 
  479.      initialized. You may need the ASK command if your telephone system 
  480.      uses special telecommunications equipment.
  481. Syntax    
  482.      ASK maskflag "message"
  483. Parameters    
  484.      maskflag         1 or true indicates that the user‚Äôs input is masked with dots
  485.                                (‚Ä¢‚Ä¢‚Ä¢‚Ä¢)
  486.                                         0 or false indicates that the user‚Äôs input is displayed as 
  487.                                normal text
  488.      message           the prompt displayed in the dialog for the user
  489. Example    
  490.      ASK true "Enter your password"
  491.  
  492.  
  493. NOTE    
  494.      sends messages to the internal Activity Log. Optionally, you can set the 
  495.      message level to specify where the message should appear.
  496. Syntax    
  497.      NOTE msgStr msgLevel
  498. Parameters    
  499.      msgStr         the message parameter passed
  500.      msgLevel         1 sends the message to the Activity Log only
  501.                                2 sends the message to the Status window only (default)
  502.                                         3 sends the message to the Activity Log and Status window
  503. Example    
  504.      NOTE "Dialing ^1"
  505.  
  506.  
  507. USERHOOK    
  508.      causes the script to perform a special action. USERHOOK passes a 
  509.      parameter to the internal hook, so this hook can perform more than one 
  510.      function.
  511. Syntax    
  512.      USERHOOK opcode
  513. Parameters    
  514.      opcode         1 marks a connection as active when a call is answered and a
  515.                           ring is indicated by the modem 
  516.                                    2 causes a terminal window to be displayed
  517. Example    
  518.      USERHOOK 2
  519.  
  520.  
  521.  
  522. B.12 Pattern Matching Commands
  523.  
  524. MATCHCLR    
  525.      clears all match strings. The CCL interpreter has an internal buffer that
  526.      holds up to 16 strings identified with the MATCHSTR command.The
  527.      buffer holds this information until it is erased with a MATCHCLR 
  528.      command. You should use MATCHCLR at the beginning of every 
  529.      modem script to clear the buffer.
  530. Syntax    
  531.      MATCHCLR
  532.  
  533. MATCHREAD    
  534.      reads input from the serial driver and compares the input to the current 
  535.      match strings. If a match is found in the specified time, execution 
  536.      continues at the label of the matching match string.
  537. Syntax    
  538.      MATCHREAD time
  539. Parameters    
  540.      time         the time allowed for a match, in tenths of a second
  541.  
  542.             ¬†The following example searches for a match within 3 seconds.
  543.  
  544.  
  545. Example    
  546.      MATCHREAD 30
  547.  
  548.  
  549. MATCHSTR    
  550.      specifies a string to match incoming characters against. If a stream of 
  551.      consecutive incoming characters matches the string, script execution 
  552.      continues at the specified label. Sixteen possible match strings exist.
  553. Syntax    
  554.      MATCHSTR matchNum matchLabel matchStr
  555. Parameters    
  556.      matchNum          a value from 1-16
  557.      matchLabel         the label to jump to, where execution continues
  558.      matchStr              a string (1-255 characters) to compare against
  559.  
  560.         ¬†   The following example matches the string "OK\13\10" with match 
  561.              string one. If the strings match, then execution jumps to label 8.
  562.  
  563. Example    
  564.      MATCHSTR 1 8 "OK\13\10"
  565.